package pak

import (
	"fmt"
    "github.com/shirou/gopsutil/disk"
)

//获取所有挂载点的使用情况
func GetAll(){
	partitions, err := disk.Partitions(false)
	if err != nil {
		fmt.Println("Error getting partitions")
	}
 
	var total uint64
	var used uint64
 
	for _, partition := range partitions {
		usage, err := disk.Usage(partition.Mountpoint)
		if err != nil {
			fmt.Printf("Error getting usage for %s", partition.Mountpoint)
			continue
		}
 
		total += usage.Total
		used += usage.Used
	}
 
	// 计算总使用率
	usagePercent := float64(used) / float64(total) * 100
 
	// 打印总磁盘使用率信息
	fmt.Printf("Total Disk Usage: %.2f%%\n", usagePercent)
	fmt.Printf("Total: %v GB\n", total/1024/1024/1024)
	fmt.Printf("Used: %v GB\n", used/1024/1024/1024)
	fmt.Printf("Free: %v GB\n", (total-used)/1024/1024/1024)
}